package com.itheima.dao;

import com.itheima.pojo.Account;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface AccountDao {
    //转出
    @Update("update account set money = money - #{money} where id = #{outId}")
    int outMoney(@Param("outId") int outId, @Param("money")double money);
    //转入
    @Update("update account set money = money + #{money} where id = #{inId}")
    int inMoney(@Param("inId") int inId, @Param("money")double money);

    @Insert("insert into db_log(message) values(#{msg})")
    int insertLog(@Param("msg") String msg);

    @Select("select * from account")
    List<Account> findAll();

}
